package mylittleinvestigations;

import mylittleinvestigations.CaseInformation.CaseXmlWriter;
import mylittleinvestigations.CaseInformation.CaseXmlReader;
import java.io.IOException;

public class ConfrontationTopic
{
    private String id;
        
    public String getId() { return this.id; }

    private String name;

    public String getName() { return this.name; }

    private int actionIndex;

    public int getActionIndex() { return this.actionIndex; }

    private boolean isEnabled;

    public boolean getIsEnabled() { return this.isEnabled; }
    public void setIsEnabled(boolean isEnabled) { this.isEnabled = isEnabled; }
    
    private boolean isCompleted;

    public boolean getIsCompleted() { return this.isCompleted; }
    public void setIsCompleted(boolean isCompleted) { this.isCompleted = isCompleted; }

    public ConfrontationTopic(String id, String name, int actionIndex)
    {
        this.id = id;
        this.name = name;
        this.actionIndex = actionIndex;
        this.isEnabled = false;
        this.isCompleted = false;
    }

    void SaveToXml(CaseXmlWriter writer) throws IOException
    {
        writer.StartElement("ConfrontationTopic");
        
        if (this.id != null)
        {
            writer.WriteTextElement("Id", this.id);
        }
        
        if (this.name != null)
        {
            writer.WriteTextElement("Name", this.name);
        }
        
        writer.WriteIntElement("ActionIndex", this.actionIndex);
        writer.WriteBooleanElement("IsEnabled", this.isEnabled);
        writer.EndElement();
    }

    ConfrontationTopic(CaseXmlReader reader)
    {
        reader.StartElement("ConfrontationTopic");
        
        if (reader.ElementExists("Id"))
        {
            this.id = reader.ReadTextElement("Id");
        }
        
        if (reader.ElementExists("Name"))
        {
            this.name = reader.ReadTextElement("Name");
        }
        
        this.actionIndex = reader.ReadIntElement("ActionIndex");
        this.isEnabled = reader.ReadBooleanElement("IsEnabled");
        reader.EndElement();
    }
}